package J20250227_dfs;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: 机器人塔——https://www.lanqiao.cn/problems/118/learning/?page=1&first_category_id=1&tags=DFS&tag_relation=intersection
 * User: 王圆豪
 * Date: 2025-03-12
 * Time: 17:02
 */
public class Main3 {
    static int m;
    static int n;
    static int len;
    static long ret = 0;
    static char[][] arr;
    static char[] c = {'A','B'};
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        m = scan.nextInt();
        n = scan.nextInt();
        len = (int)Math.sqrt((m+n)*2);
        arr = new char[len][len];
        dfs(0);
        System.out.print(ret);
        scan.close();
    }

    public static void dfs(int step){
        if(step == len){
            if(check()) ret++;
            return;
        }

        for(int i = 0; i < 2; i++){
            arr[len-1][step] = c[i];
            dfs(step+1);
        }
    }

    public static boolean check(){
        int a = 0;
        int b = 0;
        for(int i = len - 2; i >= 0; i--){
            for(int j = 0; j <= i; j++){
                if(arr[i+1][j+1] == arr[i+1][j]){
                    arr[i][j] = 'A';
                }else arr[i][j] = 'B';
            }
        }

        for(int i = 0; i < len; i++){
            for(int j = 0; j <= i; j++){
                if(arr[i][j] == 'A') a++;
                else b++;
            }
        }
        return (a == m && b == n);
    }
}
